<!DOCTYPE html>
<html lang="en">
<include file="./Application/Home/View/Layout/head.html" />

        <link href="__PUBLIC__/assets/bootstrap/css/font-awesome.min.css" rel="stylesheet">
        <link href="__PUBLIC__/assets/bootstrap/css/select2.css" rel="stylesheet" />		
        <link href="__PUBLIC__/assets/bootstrap/css/jquery.dataTables.min.css" rel="stylesheet">
        <link href="__PUBLIC__/assets/bootstrap/css/bootstrap-datetimepicker.css" rel="stylesheet">
		<link href="__PUBLIC__/assets/bootstrap/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
        <link href="__PUBLIC__/assets/bootstrap/css/bootstrap-multiselect.css" rel="stylesheet">
		<link href="__PUBLIC__/assets/bootstrap/css/jquery.audioplayer.css" rel="stylesheet" />
		
		<style type="text/css">
.loadEffect{
    width: 100px;
    height: 100px;
    position: relative;
    margin: 0 auto;
	display:none;
 }
 .loadEffect span{
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: lightgreen;
    position: absolute;
    -webkit-animation: load 1.04s ease infinite;
 }
 @-webkit-keyframes load{
    0%{
       opacity: 1;
    }
    100%{
       opacity: 0.2;
    }
 }
 .loadEffect span:nth-child(1){
    left: 0;
    top: 50%;
    margin-top:-8px;
    -webkit-animation-delay:0.13s;
 }
 .loadEffect span:nth-child(2){
    left: 14px;
    top: 14px;
    -webkit-animation-delay:0.26s;
 }
 .loadEffect span:nth-child(3){
    left: 50%;
    top: 0;
    margin-left: -8px;
    -webkit-animation-delay:0.39s;
 }
 .loadEffect span:nth-child(4){
    top: 14px;
    right:14px;
    -webkit-animation-delay:0.52s;
 }
 .loadEffect span:nth-child(5){
    right: 0;
    top: 50%;
    margin-top:-8px;
    -webkit-animation-delay:0.65s;
 }
 .loadEffect span:nth-child(6){
    right: 14px;
    bottom:14px;
    -webkit-animation-delay:0.78s;
 }
 .loadEffect span:nth-child(7){
    bottom: 0;
    left: 50%;
    margin-left: -8px;
    -webkit-animation-delay:0.91s;
 }
 .loadEffect span:nth-child(8){
    bottom: 14px;
    left: 14px;
    -webkit-animation-delay:1.04s;
 }
 .Alertmessage{
	text-align: center;
    color: red;
 }

 #basicTable_length{
        float: right;
        margin-right: 10px;
 }

 .multiselect-native-select  ul{
    max-height: 450px;
    overflow: auto;
    width: 250px;
}

.fynr{
    width: 750px;

    word-wrap:break-word;
        line-height: 28px;
    height: 350px;
    overflow: auto;
}
        </style>
 

    <body>
        <block name="header">
           <include file="block/header"/>
        </block>
        <section>
            <div class="mainwrapper">
			   <block name="left">
			   <include file="block/left" />
               </block>
                
                <div class="mainpanel">
                    <div class="contentpanel">
                       
                        <div class="panel panel-title-head" >
                        <!--<form id="form1">-->
                            <div class="search_banner">
                                <div class="clearfix">
	                                <!-- <div class="pull-left col-md-1">
	                                    <h4 class="panel-title">录音查询</h4>
	                                </div> -->
	                                <div class="pull-left col-md-3">
	                                <div class="input-group" style="padding:5px;">
		                                <lable class="pull-left">开始时间：<input name="datetimepicker_start" id="datetimepicker_start" type="text" value="{$datetimepicker_start}" /></lable><br>
		                             </div>
		                             <div class="input-group" style="padding:5px;">
		                                <lable class="pull-left">结束时间：<input name="datetimepicker_end" id="datetimepicker_end" type="text" value="{$datetimepicker_end}" /></lable>                     
	                                 </div>
	                                </div>
	                                <div class="pull-left ">
	                                 	<div class="search_input_group">
	                                 	      
										      <span class="search_input-group-addon">
										        <input name="SearchMode"   value="0" type="radio" aria-label="...">按号码查询
										        <input name="SearchMode"   value="1" type="radio" aria-label="...">按姓名查询
										      </span>
										      <input type="text" style="min-width:60px;max-width:65px;" name="search_key" id="search_key" class="search_form-control" aria-label="..." value="">
										     
									    </div><!-- /input-group -->
									    <div class="search_input_group">
										      <span class="search_input-group-addon">
										        <input name="InOut" value="2" type="radio" aria-label="...">拨出和来电
										        <input name="InOut" value="1" type="radio" aria-label="...">拨出
										        <input name="InOut" value="0" type="radio" aria-label="...">来电
										        <input name="has_video" id="has_video" value="0" type="checkbox" aria-label="...">有录像
										      </span>
									    </div><!-- /input-group -->
	                                </div>
	                                <div class="pull-left col-md-3">
		                                <div class="search_input_group">
										      <span class="search_input-group-addon">
										        	时长大于等于（秒）：
										      </span>
										      <input type="text" name="stime" id="stime"  class="search_form-control" value="1">
									    </div>
                                        <label for="id_select"></label>
                                            <select id="channels_sel" multiple="multiple" data-size="5">
                                                 <foreach name="rsChno" item="chnolist">
                                                      <option value="{$chnolist.chno}">{$chnolist.channelname}</option>
                                                 </foreach>
                                            </select> 
	                                </div>
	                                <div class="col-md-3">
	                                	 
										       
										    <!-- <div class="dropdown-menu dropdown-menu-right">
											  	<div class="dropdown-menu-floatlist">
											  		<div id="channelblock" class="labelblock">
												  		<foreach name="rsChno" item="chnolist">
												  			<label for='chkChnl_{$chnolist.n_channelno}'><input type="checkbox" id='chkChnl_{$chnolist.n_channelno}' value="{$chnolist.n_channelno}"  name="chk_CN"/>{$chnolist.n_channelno}</label>
													  	</foreach>
											  		</div>
											  		<div class="clearfix">
											  			<label class="pull-right allchecked"><input id="allCheckBox" type="checkbox" />全选/全否</label>
											  			<p class="tip pull-right text-primary">提示:查找所有通道时可全不选中</p>
											  		</div>
											  	</div>
									    	</div> -->
									    <div class="search_input_group">
										      <span class="search_input-group-addon">
										        	备注：
										      </span>
										      <input type="text" name="remark" id="remark"  class="search_form-control" value="">
									    </div> 
								    	<div class="col-xs-6">
								    		<div class="btn btn-info btn-large search">开始搜索</div>
										</div>
	                                </div>
                                </div>
                            </div>
                        <!--</form>-->
                        	
                        <!-- panel-heading -->
                        <div style="line-height: 50px;height: 50px;">
                             <div class="pull-left ">
	                                <button class="btn btn-primary btn-small " type="button" onclick="play('','')">播放选中录音</button>
	                          </div> 
	                          <div class="pull-left ">
	                                <button class="btn btn-info btn-small" type="button"  onclick="vplay('','')">播放选中录像</button>
	                          </div>
                             <div class="pull-left ">
	                                <button class="btn btn-danger btn-small" type="button" onclick="del(<?php echo canDel(); ?>)"
                    alt="删除选中记录">删除选中记录</button>
	                          </div> 
	                          <div class="pull-left ">
	                                <button class="btn btn-warning btn-small" type="button"  onclick="batDown({$iscan})" >打包下载录音</button>
	                          </div>
							  <div class="pull-left ">
	                                <button class="btn btn-default btn-small" type="button"  onclick="batDownVideo({$iscan})" >打包下载录像</button>
	                          </div>
                              <div class="pull-left ">
                                    <button class="btn btn-success btn-small" type="button"  onclick="batDownExcel({$iscan})" >导出录音EXCEL</button>
                              </div>
                            <!--   <div class="pull-right ">
                                    <label>每页显示</label>
                                    <select name="pageSize" id="pageSize" onchange="changeSearch()">
                                        <option value="10">10条</option>
                                        <option value="20">20条</option>
                                        <option value="50">50条</option>
                                        <option value="100">100条</option>
                                        <option value="200">200条</option>
                                        <option value="500">500条</option>
                                        <option value="1000">1000条</option>
                                    </select>
                              </div> -->
	                          <div style="clear:both"></div>
                         </div>
						 <div class="table-responsive" style="max-height: 650px;width:100%;">
                            <table id="basicTable"  class="table table-striped table-bordered" >
                                <thead class="">
                                    <tr>
                                        <td><input type="checkbox" id="checked_all"></td>
                                        <th>线路号</th>
                                        <th>线路信息</th>
                                        <th>主叫</th>
                                        <th>被叫</th>
                                        <th>录音号码</th>
                                        <th>方向</th>
                                        <th>开始时间</th>
                                        <th>结束时间</th>
                                        <th>时长</th>
                                        <th>录音播放</th>
                                        <th>主叫录像</th>
                                        <th>被叫录像</th>
                                        <th>锁定</th>
                                        <th>备注</th>
                                    </tr>
                                </thead>
                         
                                <tbody>
                                  
                                </tbody>
                            </table>
							</div>
                        </div><!-- panel -->
                           
                        </div><!-- panel -->
                      
                    </div><!-- contentpanel -->
            </div><!-- mainwrapper -->
        </section>
		
		<div class="modal fade" id="videoPlayMod" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		  <div class="modal-dialog" role="document">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" id="myModalLabel" style="text-align: center;">正在玩命地打包</h4>
		      </div>
		      <div class="modal-body">
		        <div class="inner">
		        	<h4 class="downloadName"></h4>
		        </div>
		        <div class="loadEffect">
				     <span></span>
				     <span></span>
				     <span></span>
				     <span></span>
				     <span></span>
				     <span></span>
				     <span></span>
				     <span></span>
				</div>
		      </div>
		      <div class="modal-footer">
		        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
		        <!-- <button type="button" class="btn btn-primary">确定</button> -->
		      </div>
		    </div>
		  </div>
		</div>
		
		
		<!-- 告警模态框 -->
		<div class="modal fade" id="alertModel" tabindex="-1" role="dialog" aria-labelledby="myAlert">
		  <div class="modal-dialog" role="document" style="width:450px">
		    <div class="modal-content" >
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" id="myAlert" style="text-align: center;">提示</h4>
		      </div>
		      <div class="modal-body">
		        <div class="inner">
		        	<h4 class="Alertmessage"> </h4>
		        </div>
		        
		      </div>
		      <div class="modal-footer">
		        <button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
		        <!-- <button type="button" class="btn btn-primary">确定</button> -->
		      </div>
		    </div>
		  </div>
		</div>

        <!-- 翻译内容模态框 -->
        <div class="modal fade" id="fanyiModel" tabindex="-1" role="dialog" aria-labelledby="myFanyi">
          <div class="modal-dialog" role="document" style="width:800px">
            <div class="modal-content" >
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myFanyi" style="text-align: center;">翻译内容</h4>
              </div>
              <div class="modal-body">
                <div class="inner">
                    <div class="loadEffect">
                         <span></span>
                         <span></span>
                         <span></span>
                         <span></span>
                         <span></span>
                         <span></span>
                         <span></span>
                         <span></span>
                     </div>
                     <div class="fynr"></div>
                     
                </div>
                
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
                <!-- <button type="button" class="btn btn-primary">确定</button> -->
              </div>
            </div>
          </div>
        </div>


        <!-- 翻译内容模态框 -->
        <div class="modal fade" id="beizhuModel" tabindex="-1" role="dialog" aria-labelledby="mybeizhu">
          <div class="modal-dialog" role="document" style="width:800px">
            <div class="modal-content" >
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="mybeizhu" style="text-align: center;">备注内容</h4>
              </div>
              <div class="modal-body">
                <div class="inner">
                    <div class="loadEffect">
                         <span></span>
                         <span></span>
                         <span></span>
                         <span></span>
                         <span></span>
                         <span></span>
                         <span></span>
                         <span></span>
                     </div> 
                     <div><textarea id='bznr' name='bznr' rows="3" cols="105"></textarea></div>
                     
                </div>
                
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary save" data-remarkid="" data-n_backup="">保存</button>
              </div>
            </div>
          </div>
        </div>

        <script src="__PUBLIC__/assets/bootstrap/js/jquery-1.11.1.min.js"></script>
        <script src="__PUBLIC__/assets/bootstrap/js/bootstrap.min.js"></script>
        <script src="__PUBLIC__/assets/bootstrap/js/jquery.datatables.min.js"></script>
        <script src="__PUBLIC__/assets/bootstrap/js/bootstrap-datetimepicker.js"></script>
        <script src="__PUBLIC__/assets/bootstrap/js/bootstrap-multiselect.js"></script>
        <script src="__PUBLIC__/assets/bootstrap/js/custom.js"></script>
        <script src="__PUBLIC__/assets/bootstrap/js/jquery.audioplayer.js"></script>
<script type="text/javascript">


var CHANNEL_ARR = new Array();
var CHANNEL_TB;
var InOut = '';
var SearchMode = '';
var has_video = 0;
$(document).ready( function () {
    var canSearch = "{$canSearch}";
    if(canSearch == 0){
        $('#alertModel2').modal('show');
        $('.Alertmessage').html('没有查询权限，请联系管理员')
        return;
    }

	$('#channels_sel').multiselect({
            includeSelectAllOption: true,
            enableFiltering: true,
            buttonWidth: '200px'
        });
 
CHANNEL_TB = $('#basicTable').dataTable(
        {
        	
            "ajax": {  //类似jquery的ajax参数，基本都可以用。
                "type": "post",  //后台指定了方式，默认get，外加datatable默认构造的参数很长，有可能超过get的最大长度。
                "url": "{:U('record/recordList')}",
//              "dataSrc": "data",  //默认data，也可以写其他的，格式化table的时候取里面的数据
                "dataType":"json",
                "data":  function (d){  //d 是原始的发送给服务器的数据，默认很长。
                	$("input:radio[name='InOut']:checked").each(function() { 
                		InOut = $(this).val();  // 每一个被选中项的值
                    });	
                	$("input:radio[name='SearchMode']:checked").each(function() { 
                		SearchMode = $(this).val();  // 每一个被选中项的值
                    });
                	if($('#has_video').is(':checked')){
                		has_video = 1;
                	}else{
					    has_video = 0;
					}
					 
                    //console.log($('#channels_sel').val())
                	d.chk_CN = String($('#channels_sel').val());
                	d.datetimepicker_start=$('#datetimepicker_start').val();
                	d.datetimepicker_end=$('#datetimepicker_end').val();
                	d.SearchMode=SearchMode;
                	d.InOut=InOut;
                	d.search_key=$('#search_key').val();
                	d.has_video=has_video;
                	d.stime=$('#stime').val();
					d.remark = $("#remark").val();
                    return d;
//              	d.chk_CN = CHANNEL_ARR;
//                  d.is_search = $('#is_search').val();
//                  $('#is_search').val(0);
                    //获取是否是查询,然后置0，0为非搜索查询
                }
            },
        
            "pagingType": "full_numbers",
            //"sPaginationType": "full_numbers", //分页风格，full_number会把所有页码显示出来（大概是，自己尝试）
            "sDom": "<'row-fluid inboxHeader'<'span6'<'dt_actions'>l><'span6'f>r>t<'row-fluid inboxFooter'<'span6'i><'span6'p>>", //待补充
            "aLengthMenu": [[10, 20, 50,100,500,1000], [10, 20, 50,100,500,1000]],
            "iDisplayLength": 10,  //每页显示10条数据
            "bAutoWidth": false,  //宽度是否自动，感觉不好使的时候关掉试试
            "bLengthChange": true,
            
            "bFilter": false,
            "oLanguage": {  //下面是一些汉语翻译
                "sSearch": "搜索",
                "sLengthMenu": "每页显示 _MENU_ 条记录",
                "sZeroRecords": "没有检索到数据",
                "sInfo": "显示 _START_ 至 _END_ 条 &nbsp;&nbsp;共 _TOTAL_ 条",
                "sInfoFiltered": "(筛选自 _MAX_ 条数据)",
                "sInfoEmtpy": "没有数据",
                "sProcessing": "正在加载数据...",
                "oPaginate":
                        {
                            "sFirst": "首页",
                            "sPrevious": "前一页",
                            "sNext": "后一页",
                            "sLast": "末页"
                        }
            },
            "bProcessing": true, //开启读取服务器数据时显示正在加载中……特别是大数据量的时候，开启此功能比较好
            "bServerSide": true, //开启服务器模式，使用服务器端处理配置datatable。注意：sAjaxSource参数也必须被给予为了给datatable源代码来获取所需的数据对于每个画。 这个翻译有点别扭。开启此模式后，你对datatables的每个操作 每页显示多少条记录、下一页、上一页、排序（表头）、搜索，这些都会传给服务器相应的值。
//            "sAjaxSource": '__URL__/serach_nasty', //给服务器发请求的url
            "aoColumns": [  //这个属性下的设置会应用到所有列，按顺序没有是空
            	{"mData": function (mData)
             	   {
                     return "<input type='checkbox' class='checked_per_pro' name='checked_per_pro'  value='"+mData.n_sn+"' />";
                    }
             	},
                {"mData": 'n_channelid'},
                {"mData": 'n_channelinfo'},
                {"mData": 'v_caller'},
                {"mData": 'v_called'},
                {"mData": 'v_ext'},
                {"mData": 'n_calldirection'},
                {"mData": 'd_starttime'},
                {"mData": 'd_stoptime'},
                {"mData": 'longtime'},
                {"mData": function(mData){
                    /*if(mData.translate !=''){
                        return mData.v_voicefileplay+"&nbsp;&nbsp;<span class='fanyi' style='cursor:pointer;' data-sn='"+mData.n_sn+"')'>翻译</span>";
                    }*/
                    return mData.v_voicefileplay;
                }},
                {"mData": 'local_video'},
                {"mData": 'remote_video'},
                {"mData": 'n_lock_info'},
                {"mData": 'remark_info'}
            ],

            "aoColumnDefs": [//和aoColums类似，但他可以给指定列附近属性
                {"bSortable": false, "aTargets": [0,1, 3, 6, 7, 8]}, //这句话意思是第1,3,6,7,8,9列（从0开始算） 不能排序
                {"bSearchable": false, "aTargets": [1, 2, 3, 4, 5, 6, 7, 8]} //bSearchable 这个属性表示是否可以全局搜索，其实在服务器端分页中是没用的
            ],
            "aaSorting": [[2, "desc"]], //默认排序
            "fnInitComplete": function (oSettings, json) { //表格初始化完成后调用 在这里和服务器分页没关系可以忽略
                $("input[aria-controls='DataTables_Table_0']").attr("placeHolder", "请输入高手用户名");
            }
            
        });
        
$('.search').click(function(){
    var canSearch = "{$canSearch}";
    if(canSearch == 0){
        $('#alertModel2').modal('show');
        $('.Alertmessage').html('没有查询权限，请联系管理员')
        return;
    }
    CHANNEL_TB.fnClearTable();
    CHANNEL_TB.fnReloadAjax();
     
}) 

 jQuery('#datetimepicker_start').datetimepicker.dates['zh'] = { 
        format : "yyyy-mm-dd hh:ii:ss", 
        days:       ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六","星期日"],  
        daysShort:  ["日", "一", "二", "三", "四", "五", "六","日"],  
        daysMin:    ["日", "一", "二", "三", "四", "五", "六","日"],  
        months:     ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月","十二月"],  
        monthsShort:  ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"],  
        meridiem:    ["上午", "下午"],  
        //suffix:      ["st", "nd", "rd", "th"],  
        today:       "今天"  
}; 

jQuery('#datetimepicker_end').datetimepicker.dates['zh'] = {  
    format : "yyyy-mm-dd hh:ii:ss",
    days:       ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六","星期日"],  
    daysShort:  ["日", "一", "二", "三", "四", "五", "六","日"],  
    daysMin:    ["日", "一", "二", "三", "四", "五", "六","日"],  
    months:     ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月","十二月"],  
    monthsShort:  ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"],  
    meridiem:    ["上午", "下午"],  
    //suffix:      ["st", "nd", "rd", "th"],  
    today:       "今天"  
}; 
		
	jQuery('#datetimepicker_start').datetimepicker({language:'zh'});
	jQuery('#datetimepicker_end').datetimepicker({language:'zh'});
	

	$('.dropdown-menu-floatlist').on('click',function(e){
		e.stopPropagation();
	}).on('change','#allCheckBox', function(e){
//		console.log($(e.target).prop('checked'))
		$('#channelblock').find('[type=checkbox]').prop('checked',$(e.target).prop('checked'));
		channelArrSet();
	}).on('change','#channelblock [type=checkbox]', function(e){
		channelArrSet();
	});
	
	
	
	$('body').on('click', '.video-play',function(e){
		e.preventDefault();
		$('#videoPlayMod').modal('show');
		var $tr = $(e.currentTarget).parents('tr').clone();
		$('#videoPlayMod').find('table').find('tbody').html($tr)
	});
	
	$('#videoPlayMod').on('show.bs.modal',function(e){
//		console.log(e)
		$(e.target).find('.videoName').text('123')	
		$(e.target).find('.videoBlock').html('<audio src="" controls="controls">您的浏览器不支持 video 标签。</audio>');
		$(e.target).find('audio').attr('src','__PUBLIC__/assets/video/Iron.mp3').audioPlayer();
	})
	
	$('#videoPlayMod').on('hidden.bs.modal',function(e){
		$(e.target).find('.videoBlock').empty()
	})
	
	

})  

function changeSearch(){
    var canSearch = "{$canSearch}";
    if(canSearch == 0){
        $('#alertModel2').modal('show');
        $('.Alertmessage').html('没有查询权限，请联系管理员')
        return;
    }
     CHANNEL_TB.fnClearTable();
    CHANNEL_TB.fnReloadAjax();
}
function channelArrSet(){
	CHANNEL_ARR = [];
	$('#channelblock').find('[type=checkbox]').each(function(){
		if($(this).prop('checked') == true)
		CHANNEL_ARR.push(parseInt($(this).val()));
	})
	CHANNEL_ARR.sort();
}

function channelElnSet(arr){
	CHANNEL_ARR = arr;
	for(var i in CHANNEL_ARR){
		$('chkChnl_'+CHANNEL_ARR[i]).prop('checked')
	}
}

$("#checked_all").click(function() {
    var state = $("#checked_all").prop("checked");
    if(state == true) {
        $(".checked_per_pro").prop("checked", "checked");
    } else {
        $(".checked_per_pro").prop("checked", "");
    }
});



function play(N_SN,fname){
    var canSearch = "{$canSearch}";
    if(canSearch == 0){
        $('#alertModel2').modal('show');
        $('.Alertmessage').html('没有查询权限，请联系管理员')
        return;
    }
    //获得窗口的垂直位置
    var iTop = (window.screen.availHeight - 30 - 380) / 2;
    //获得窗口的水平位置
    var iLeft = (window.screen.availWidth - 10 - 550) / 2;
    var url="voicePlayer?Rnd="+Math.random()+"&listItem=";
    if(N_SN!=""){
        var dsc="dialogWidth=550px;dialogHeight=425px;status=no";
        window.open(url+N_SN+"&fname="+fname,"player","height=380,width=550, top="+ iTop + ",left="+ iLeft + ", toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no");
    }
    else
    {
        //点击播放选中的录音
        var Items =""
        $('input[name="checked_per_pro"]:checked').each(function(){
            if(Items ==""){
                Items = $(this).val()
            }
            else{
                Items = Items +","+ $(this).val()
            }
        });
        if(Items!=""){
            //window.open(url+Items);
            window.open(url+Items,"player","height=380,width=550, top="+ iTop + ",left="+ iLeft + ",toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no");
        }else{
            $('#alertModel').modal('show');
            $('.Alertmessage').html('请选择要播放的录音')
            return;
        }
    }
}


//播放当前选中的录音
function playold(N_SN,fname){
    var canSearch = "{$canSearch}";
    if(canSearch == 0){
        $('#alertModel2').modal('show');
        $('.Alertmessage').html('没有查询权限，请联系管理员')
        return;
    }
	//获得窗口的垂直位置 
    var iTop = (window.screen.availHeight - 30 - 380) / 2; 
    //获得窗口的水平位置 
    var iLeft = (window.screen.availWidth - 10 - 550) / 2;
    
	var url="voicePlayer?Rnd="+Math.random()+"&listItem=";
	if(N_SN!=""){
         //直接点击某条录音的小喇叭，只播放当前录音
		var dsc="dialogWidth=550px;dialogHeight=425px;status=no";
		window.open(url+N_SN+"&fname="+fname,"player","height=380,width=550, top="+ iTop + ",left="+ iLeft + ", toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no");
		
	}else{
		//点击播放选中的录音
		var Items =""
		 $('input[name="checked_per_pro"]:checked').each(function(){ 
			 if(Items ==""){
				 Items = $(this).val()
			 }
			 else{
				 Items = Items +","+ $(this).val()
			 }
		}); 
		if(Items!=""){
			//window.open(url+Items);
			window.open(url+Items,"player","height=380,width=550, top="+ iTop + ",left="+ iLeft + ",toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no");
		}else{
			$('#alertModel').modal('show');
			$('.Alertmessage').html('请选择要播放的录音') 
			return;
		}
	}
}

 
 
//播放当前选中的录音
function vplay(N_SN,fname){
    var canSearch = "{$canSearch}";
    if(canSearch == 0){
        $('#alertModel2').modal('show');
        $('.Alertmessage').html('没有查询权限，请联系管理员')
        return;
    }
	//获得窗口的垂直位置 
    var iTop = (window.screen.availHeight - 30 - 700) / 2; 
    //获得窗口的水平位置 
    var iLeft = (window.screen.availWidth - 10 - 700) / 2;
    
	var url="videoPlayer?Rnd="+Math.random()+"&listItem=";
	//var dsc="dialogWidth=450px;dialogHeight=400px;status=no";
	if(N_SN!=""){
		//直接点击某条录音的小喇叭，只播放当前录音
		var dsc="dialogWidth=450px;dialogHeight=425px;status=no";
		 
        window.open(url+N_SN+"&fname="+fname,"player","height=700,width=550, top="+ iTop + ",left="+ iLeft + ", toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no");
		//模式窗口，需关闭播放器后才能选择其他录音，不方便
		//window.showModalDialog(url+N_SN+"&fname="+fname,"录音文件试听",dsc);
		
	}else{
		//点击播放选中的录音
		var Items =""
		 $('input[name="checked_per_pro"]:checked').each(function(){ 
			 if(Items ==""){
				 Items = $(this).val()
			 }
			 else{
				 Items = Items +","+ $(this).val()
			 }
		}); 
		if(Items!=""){
			//window.open(url+Items);
			window.open(url+Items,"player","height=700,width=550, top="+ iTop + ",left="+ iLeft + ",toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no");
			//window.showModalDialog(url+Items,"录音文件试听",dsc);
		}else{
			$('#alertModel').modal('show');
			$('.Alertmessage').html('请选择要播放的录象') 
			return;
		}
	}
}


//锁定录音/录音解锁
function lock(n_sn,n_lock,n_backup,obj)
{
    var canManage = "{$canManage}";
    if(canManage == 0){
        $('#alertModel2').modal('show');
        $('.Alertmessage').html('没有管理权限，请联系管理员')
        return;
    }
    var n_sn = n_sn
    var n_lock =  n_lock==1?0:1;
    var n_backup =n_backup
    var img = n_lock==1?0:1;
   
    var url = "/home/record/recordLockop"
    $.ajax({
        type:"POST",
        url:url,
        data:{
            n_sn:n_sn,n_lock:n_lock,n_backup:n_backup 
        },
        success: function(data){ 
            alert(data.message);
            if(data.code){ 
                changeSearch()
            }
        }
    })
}



//删除选中的记录
function del(flag){
    var canManage = "{$canManage}";
    if(canManage == 0){
        $('#alertModel2').modal('show');
        $('.Alertmessage').html('没有管理权限，请联系管理员')
        return;
    }
	//删除选中的录音
	var toDel =""
	 $('input[name="checked_per_pro"]:checked').each(function(){ 
		 if(toDel ==""){
			 toDel = $(this).val()
		 }
		 else{
			 toDel = toDel +","+ $(this).val()
		 }
	}); 
	if(toDel==""){
		$('#alertModel').modal('show');
		$('.Alertmessage').html('请选中要删除的记录') 
		return;
	}else{
		var msg="注意！！\r\n\n此操作将把所选记录(锁定记录除外)及相关录音文件彻底删除";
		msg+="\r\n\n确定删除所选记录？";
		var url="delRecord"
		if(confirm(msg)){
			$.ajax({
				type:"POST",
				url:url,
				data:{
					strID:toDel	
				},
				success: function(data){
					 
					if(data.code){
						alert(data.message);
            CHANNEL_TB.fnClearTable();
            CHANNEL_TB.fnReloadAjax();
            // window.location.href="/home/record/recordList"
					}
				}
			})
		}
	}
}

//打包下载
function batDown(flag){
    var canSearch = "{$canSearch}";
    if(canSearch == 0){
        $('#alertModel2').modal('show');
        $('.Alertmessage').html('没有查询权限，请联系管理员')
        return;
    }
	var Items =""
	var i ="0"
		 $('input[name="checked_per_pro"]:checked').each(function(){ 
			 if(Items ==""){
				 Items = $(this).val()
			 }
			 else{
				 Items = Items +","+ $(this).val()
			 }
			 i++
		}); 
	if(Items==""){
		$('#alertModel').modal('show');
		$('.Alertmessage').html('请选择要打包的录音') 
		return;
	}
	if(i>1000){
		var tips="提示：当前记录总数超过1000条，数量较多，全部打包将有可能失败。\r\n建议区分每页打包下载";
		tips+="\r\n\r\n点击【确定】继续打包所有记录\r\n点击【取消】重新选择"
		if(!confirm(tips)){
			return false;
		}
	}
	$('#videoPlayMod').modal('show');
	$('.downloadName').css("display","none");
	var url="recordZip"
	$.ajax({
		type:"POST",
		url:url,
		data:{
			strID:Items,
			type:1
		},
		beforeSend:function(XMLHttpRequest){ 
			$('.loadEffect').css("display","block");
		}, 
		success: function(data){
			if(data.code){
				$('.loadEffect').css("display","none");
				$('.downloadName').css("display","block");
				$('.modal-title').html("操作完成");
				$('.downloadName').html(data.message)
			}
		}
	})
}

//打包录像
function batDownVideo(flag){
    var canSearch = "{$canSearch}";
    if(canSearch == 0){
        $('#alertModel2').modal('show');
        $('.Alertmessage').html('没有查询权限，请联系管理员')
        return;
    }
	var Items =""
	var i ="0"
		 $('input[name="checked_per_pro"]:checked').each(function(){ 
			 if(Items ==""){
				 Items = $(this).val()
			 }
			 else{
				 Items = Items +","+ $(this).val()
			 }
			 i++
		}); 
	if(Items==""){
		$('#alertModel').modal('show');
		$('.Alertmessage').html('请选择要打包的录像') 
		return;
	}
	if(i>1000){
		var tips="提示：当前记录总数超过1000条，数量较多，全部打包将有可能失败。\r\n建议区分每页打包下载";
		tips+="\r\n\r\n点击【确定】继续打包所有记录\r\n点击【取消】重新选择"
		if(!confirm(tips)){
			return false;
		}
	}
	$('#videoPlayMod').modal('show');
	$('.downloadName').css("display","none");
	var url="recordZip"
	$.ajax({
		type:"POST",
		url:url,
		data:{
			strID:Items,
			type:2
		},
		beforeSend:function(XMLHttpRequest){ 
			$('.loadEffect').css("display","block");
		}, 
		success: function(data){
			if(data.code){
				$('.loadEffect').css("display","none");
				$('.downloadName').css("display","block");
				$('.modal-title').html("操作完成");
				$('.downloadName').html(data.message)
			}
		}
	})
}

function batDownExcel(flag){
      /*if(!flag){
        $('#alertModel').modal('show');
        $('.Alertmessage').html('无权操作，请与管理员联系') 
        return;
      }*/

        $("input:radio[name='InOut']:checked").each(function() { 
            InOut = $(this).val();  // 每一个被选中项的值
        }); 
        $("input:radio[name='SearchMode']:checked").each(function() { 
            SearchMode = $(this).val();  // 每一个被选中项的值
        });
        if($('#has_video').is(':checked')){
            has_video = 1;
        }
        var Items =""
        var i ="0"
           $('input[name="checked_per_pro"]:checked').each(function(){ 
             if(Items ==""){
               Items = $(this).val()
             }
             else{
               Items = Items +","+ $(this).val()
             }
             i++
          }); 
        if(Items==""){
            $('#alertModel').modal('show');
                $('.Alertmessage').html('请选择要导出EXCEL的录音') 
                return;
        }
        
        chk_CN = Items;
        datetimepicker_start=$('#datetimepicker_start').val();
        datetimepicker_end=$('#datetimepicker_end').val();
        SearchMode=SearchMode;
        InOut=InOut;
        search_key=$('#search_key').val();
        has_video=has_video;
        stime=$('#stime').val();
 
        $('#videoPlayMod').modal('show');
        $('.downloadName').css("display","none");
        var url="downloadRecordExcel"
        $.ajax({
            type:"POST",
            url:url,
            data:{
                InOut:InOut,SearchMode:SearchMode,has_video:has_video,chk_CN:chk_CN,datetimepicker_start:datetimepicker_start,datetimepicker_end:datetimepicker_end,search_key:search_key
            },
            beforeSend:function(XMLHttpRequest){ 
                $('.loadEffect').css("display","block");
            }, 
            success: function(data){
                $('.loadEffect').css("display","none");
                $('.downloadName').css("display","block");
                $('.modal-title').html("操作完成");
                $('.downloadName').html("成功导出录音记录文件：<a href='"+data.data+"'>点击下载</a>")

                
            }
        })
    }

$('body').on('click', '.fanyi',function(){
    var n_sn = $(this).data('sn')
    if(n_sn ==''){
        alert('获取信息失败，请刷新重试');
        return;
    }
    $(".fynr").html('');
    $('#fanyiModel').modal('show');
    $.ajax({
        type:"post",
        url:"__ROOT__/home/login/getfanyi",
        async:true,
        data:{n_sn:n_sn}, 
        beforeSend:function(XMLHttpRequest){ 
            $('.loadEffect').css("display","block");
        }, 
        success:function(data){
            $('.loadEffect').css("display","none");
            if(data.code){  
                $(".fynr").html(data.data);
                 
                
            }else{ 
                $(".fynr").html(data.msg);
                return;
            } 
        }
    });
});   
   

    function Remark(n_sn,n_backup,obj){
        var remark = $(obj).data('rm')
        $('#bznr').val(remark)
        $('.save').data('remardid',n_sn)
        $('.save').data('n_backup',n_backup)
        $('#beizhuModel').modal('show');

    } 

    $('body').on('click', '.save',function(){
        var remarkid = $(this).data('remardid')
        var n_backup = $(this).data('n_backup')
        if(remarkid ==''){
            alert('数据获取失败，请刷新重试');return ;
        }
         var remark = $.trim($('#bznr').val())
       /* if(remark == ''){
           alert('请输入备注内容');return
        }*/
        var url = "/home/record/remarkedit"
        $.ajax({
            type:"POST",
            url:url,
            data:{
                n_sn:remarkid,remark:remark,n_backup:n_backup
            },
            success: function(data){ 
                alert(data.message);
                changeSearch()
                $('#beizhuModel').modal('hide');
            }
        })
    })
</script>        
		
		
    </body>
</html>
